<?php
declare(strict_types=1);

namespace SixShop\Lakala\Controller\Admin;

use SixShop\Core\Request;
use SixShop\Lakala\Config;
use SixShop\Lakala\Entity\ProfitShareReceiverEntity;
use think\Response;
use function SixShop\Core\page_response;
use function SixShop\Core\success_response;

class ProfitShareReceiverController
{
    public function index(Request $request, ProfitShareReceiverEntity $entity): Response
    {
        $params = $request->get([
            'status/d' => 0,
            'order_no' => '',
        ]);
        return page_response(page: $entity->getReceiverList($params, $request->pageAndLimit()));
    }

    public function read(int $id, Request $request, ProfitShareReceiverEntity $entity): Response
    {
        return success_response($entity->getReceiver(['id' => $id]));
    }

    public function apply(int $id, ProfitShareReceiverEntity $entity): Response
    {
        return success_response($entity->apply($id));
    }

    public function bind(int $id, ProfitShareReceiverEntity $entity): Response
    {
        return success_response($entity->bind($id));
    }

    public function modify(int $id, ProfitShareReceiverEntity $entity): Response
    {
        return success_response($entity->modify($id));
    }
}